<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <script type="text/javascript" src="/js/jquery-3.4.1.min.js"></script>

    <title>登录</title>
</head>
<body>
<form id="frm">
    <table>
        <tr>
            <td>用户名:</td>
            <td><input type="text" name="username" id="username"  value="admin"/></td>
        </tr>
        <tr>
            <td>密码:</td>
            <td><input type="password" value="admin" name="password"/></td>
        </tr>
    </table>
    <input type="button" value="登录" onclick="sub()"><br>
</form>
</body>

<script type="text/javascript">

    //登录
    function sub() {
            $.post(
                "<%=request.getContextPath()%>/sss/login",
                $("#frm").serialize(),
                function(data) {
                    if(data.code == '200') {
                        location.href="<%=request.getContextPath()%>/login/toList"
                    }else {
                        alert(data.msg);
                    }
                })
    }
</script>
</html>